feat: add chezmoi-development skill and fix settings.json race condition#4
Merged
feat: add chezmoi-development skill and fix settings.json race condition#4
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors Claude Code marketplace configuration to use chezmoi's .chezmoidata and modify_ script pattern for non-destructive settings management. Instead of overwriting ~/.claude/settings.json, the configuration is now merged with existing user settings.
Key changes:
- Replaced static
dot_claude/settings.jsonwith amodify_script that merges configuration - Moved configuration data to
.chezmoidata/claude.yamlfor better separation of data and logic - Added comprehensive documentation about the pattern in a new skill and reference document
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dot_claude/settings.json | Removed static configuration file (no longer needed with modify_ approach) |
| dot_claude/modify_settings.json.tmpl | New merge script that combines marketplace config with existing user settings |
| .chezmoidata/claude.yaml | Configuration data extracted from hardcoded JSON |
| .chezmoiscripts/run_before_00_remove-claude-symlink.sh.tmpl | Removed as directory creation is now handled automatically by chezmoi |
| CLAUDE.md | Updated documentation to explain the new merge-based approach |
| .claude/skills/chezmoi-development/SKILL.md | New comprehensive skill documentation for chezmoi development patterns |
| .claude/skills/chezmoi-development/references/chezmoidata-modify-example.md | New reference document with complete working example |
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Show resolved
Hide resolved
- Add comprehensive chezmoi-development skill with documentation for .chezmoidata and modify scripts - Replace dot_claude/settings.json with run_onchange_after_update-claude-settings.sh.tmpl - Add .claude to .chezmoiignore to prevent management conflicts with symlinks - Remove run_before_00_remove-claude-symlink.sh.tmpl that was breaking symlinks - Configure fx/cc marketplace and enable fx-dev@fx-cc plugin by default - Improve install.sh to detect and use local repository for testing - Clear chezmoi state database and use --force flag to avoid prompts - Suppress confusing "Cloning into" message when using local repository This approach allows .claude to remain a symlink in Coder workspaces while still applying settings updates via the run_onchange_after script, which works with both directories and symlinks.
b58f28c to
bf00725
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
.claude/skills/chezmoi-development/SKILL.md:1
- This statement is only true for
modify_scripts, not forrun_onchange_after_scripts which must read from disk. Since this PR usesrun_onchange_after_, this guidance is misleading and contradicts the actual implementation. Consider adding a clear section that explains the differences betweenmodify_andrun_onchange_approaches.
---
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Outdated
Show resolved
Hide resolved
.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md
Show resolved
Hide resolved
…error handling Address Copilot PR review feedback: - Update all documentation to correctly reference run_onchange_after_ instead of modify_ - Add comprehensive section in SKILL.md distinguishing between modify_ (stdin/stdout) and run_onchange_ (disk I/O) approaches - Clarify when to use each approach (symlinked directories require run_onchange_) - Fix install.sh error handling to properly capture chezmoi init failures - Document why --force flag is necessary in install.sh (state cleanup on lines 45-52)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive chezmoi development documentation and fixes a race condition with
~/.claude/settings.jsonmanagement.Changes
1. New chezmoi-development Skill
.chezmoidatafor configuration datamodify_scripts for non-destructive file mergingsymlink_prefix for declarative symlinks2. Fix Race Condition with ~/.claude Directory
Problem: The
run_before_00_remove-claude-symlink.sh.tmplscript was creating~/.claudedirectory before chezmoi processed files, preventing symlinking and causing issues.Solution:
run_before_script (chezmoi auto-creates parent directories)modify_script forsettings.jsondot_claude/modify_settings.json.tmplmerges marketplace config with existing user settings3. Preserve User Settings
The new
modify_script:~/.claude(Coder workspaces)Test Results
All tests pass:
~/.claudeFiles Changed
.chezmoidata/claude.yaml- Configuration data for marketplace.chezmoiscripts/run_before_00_remove-claude-symlink.sh.tmpl- No longer needed.claude/skills/chezmoi-development/SKILL.md- Comprehensive documentation.claude/skills/chezmoi-development/references/chezmoidata-modify-example.md- Working exampledot_claude/settings.jsonwithdot_claude/modify_settings.json.tmpl- Non-destructive mergingCLAUDE.md- Document the skill